/**
 */
package fUML.Semantics.Activities.IntermediateActivities;

import fUML.Syntax.Activities.IntermediateActivities.ActivityEdge;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * A representation of the model object '<em><b>Activity Edge Instance</b></em>'.
 * <!-- end-user-doc -->
 *
 * <!-- begin-model-doc -->
 * An activity edge instance is a connection between activity node activations
 *                 corresponding to an edge between the corresponding nodes of those activations
 * <!-- end-model-doc -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getEdge <em>Edge</em>}</li>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getSource <em>Source</em>}</li>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getTarget <em>Target</em>}</li>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getOffers <em>Offers</em>}</li>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getGroup <em>Group</em>}</li>
 * </ul>
 * </p>
 *
 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance()
 * @model
 * @generated
 */
public interface ActivityEdgeInstance extends EObject {
	/**
	 * Returns the value of the '<em><b>Edge</b></em>' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The activity edge of which this is an instance.
	 *  [This is optional to
	 *                   allow for an implicit fork node execution to be connected to its action execution
	 *                   by an edge instance which does not have a corresponding node in the model.]
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Edge</em>' reference.
	 * @see #setEdge(ActivityEdge)
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance_Edge()
	 * @model ordered="false"
	 * @generated
	 */
	ActivityEdge getEdge();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getEdge <em>Edge</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Edge</em>' reference.
	 * @see #getEdge()
	 * @generated
	 */
	void setEdge(ActivityEdge value);

	/**
	 * Returns the value of the '<em><b>Source</b></em>' reference.
	 * It is bidirectional and its opposite is '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getOutgoingEdges <em>Outgoing Edges</em>}'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The source of this activity edge instance.
	 *  The node of the source
	 *                   must be the same as the source of the edge of this edge instance.
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Source</em>' reference.
	 * @see #setSource(ActivityNodeActivation)
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance_Source()
	 * @see fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getOutgoingEdges
	 * @model opposite="outgoingEdges" required="true" ordered="false"
	 * @generated
	 */
	ActivityNodeActivation getSource();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getSource <em>Source</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Source</em>' reference.
	 * @see #getSource()
	 * @generated
	 */
	void setSource(ActivityNodeActivation value);

	/**
	 * Returns the value of the '<em><b>Target</b></em>' reference.
	 * It is bidirectional and its opposite is '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getIncomingEdges <em>Incoming Edges</em>}'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The target of this activity edge instance.
	 *  The node of the target
	 *                   must be the same as the target of the edge of this edge instance.
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Target</em>' reference.
	 * @see #setTarget(ActivityNodeActivation)
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance_Target()
	 * @see fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getIncomingEdges
	 * @model opposite="incomingEdges" required="true" ordered="false"
	 * @generated
	 */
	ActivityNodeActivation getTarget();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getTarget <em>Target</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Target</em>' reference.
	 * @see #getTarget()
	 * @generated
	 */
	void setTarget(ActivityNodeActivation value);

	/**
	 * Returns the value of the '<em><b>Offers</b></em>' reference list.
	 * The list contents are of type {@link fUML.Semantics.Activities.IntermediateActivities.Offer}.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Offers</em>' reference list isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Offers</em>' reference list.
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance_Offers()
	 * @model ordered="false"
	 * @generated
	 */
	EList<Offer> getOffers();

	/**
	 * Returns the value of the '<em><b>Group</b></em>' container reference.
	 * It is bidirectional and its opposite is '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivationGroup#getEdgeInstances <em>Edge Instances</em>}'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The activity group that contains this activity edge instance. 
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Group</em>' container reference.
	 * @see #setGroup(ActivityNodeActivationGroup)
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getActivityEdgeInstance_Group()
	 * @see fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivationGroup#getEdgeInstances
	 * @model opposite="edgeInstances" required="true" transient="false" ordered="false"
	 * @generated
	 */
	ActivityNodeActivationGroup getGroup();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityEdgeInstance#getGroup <em>Group</em>}' container reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Group</em>' container reference.
	 * @see #getGroup()
	 * @generated
	 */
	void setGroup(ActivityNodeActivationGroup value);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Send an offer from the source to the target.
	 *  // Keep the offered
	 *                   tokens until taken by the target.
	 *  // (Note that any one edge should only
	 *                   be handling either all object tokens or all control tokens.)
	 *  
	 *                   Offer offer = new Offer();
	 *  
	 *  for (int i = 0; i <
	 *                   tokens.size(); i++) {
	 *  Token token = tokens.getValue(i);
	 *  //
	 *                   Debug.println("[sendOffer] token value = " + token.getValue());
	 *                   offer.offeredTokens.addValue(token);
	 *  }
	 *  
	 *                   this.offers.addValue(offer);
	 *  
	 *                   this.target.receiveOffer();
	 *  
	 *  
	 * <!-- end-model-doc -->
	 * @model tokensMany="true" tokensOrdered="false"
	 * @generated
	 */
	void sendOffer(EList<Token> tokens);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Return the number of values being offered in object tokens.
	 *                   
	 *  int count = 0;
	 *  OfferList offers = this.offers;
	 *  for
	 *                   (int i = 0; i < offers.size(); i++) {
	 *  count = count +
	 *                   offers.getValue(i).countOfferedValues();
	 *  }
	 *  
	 *  return
	 *                   count;
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false"
	 * @generated
	 */
	int countOfferedValues();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Take all the offered tokens and return them.
	 *  
	 *  TokenList
	 *                   tokens = new TokenList();
	 *  
	 *  while (this.offers.size() > 0)
	 *                   {
	 *  TokenList offeredTokens =
	 *                   this.offers.getValue(0).getOfferedTokens();
	 *  for (int i = 0; i <
	 *                   offeredTokens.size(); i++) {
	 *                   tokens.addValue(offeredTokens.getValue(i));
	 *  }
	 *                   this.offers.removeValue(0);
	 *  }
	 *  
	 *  return tokens;
	 *                 
	 * <!-- end-model-doc -->
	 * @model ordered="false"
	 * @generated
	 */
	EList<Token> takeOfferedTokens();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @model ordered="false" maxCountRequired="true" maxCountOrdered="false"
	 * @generated
	 */
	EList<Token> takeOfferedTokens(int maxCount);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Get the offered tokens (after which the tokens will still be
	 *                   offered).
	 *  
	 *  TokenList tokens = new TokenList();
	 *                   OfferList offers = this.offers;
	 *  
	 *  for (int i = 0; i <
	 *                   offers.size(); i++) {
	 *  TokenList offeredTokens =
	 *                   offers.getValue(i).getOfferedTokens();
	 *  for (int j = 0; j <
	 *                   offeredTokens.size(); j++) {
	 *                   tokens.addValue(offeredTokens.getValue(j));
	 *  }
	 *  }
	 *                   
	 *  return tokens;
	 *  
	 * <!-- end-model-doc -->
	 * @model kind="operation" ordered="false"
	 * @generated
	 */
	EList<Token> getOfferedTokens();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Return true if there are any pending offers.
	 *  
	 *  boolean
	 *                   hasTokens = false;
	 *  int i = 1;
	 *  while (!hasTokens & i
	 *                   <= this.offers.size()) {
	 *  hasTokens =
	 *                   this.offers.getValue(i-1).hasTokens();
	 *  i = i + 1;
	 *  }
	 *                   
	 *  return hasTokens;
	 *  
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false"
	 * @generated
	 */
	boolean hasOffer();

} // ActivityEdgeInstance
